package com.zf.test;

import com.zf.rpc.api.ByeService;
import com.zf.rpc.api.HelloObject;
import com.zf.rpc.api.HelloService;
import com.zf.rpc.transport.RpcClientProxy;
import com.zf.rpc.serializer.CommonSerializer;
import com.zf.rpc.transport.netty.client.NettyClient;
import com.zf.rpc.transport.RpcClient;

/**
 * @ProjectName: RPC-zhaofeng
 * @Package: com.zf.test
 * @ClassName: NettyTestClient
 * @Author: zf
 * @Description:
 * @Date: 2021/5/8 11:43
 * @Version: 1.0
 */
public class NettyTestClient {
    public static void main(String[] args) {
        RpcClient nettyClient = new NettyClient(CommonSerializer.PROTOBUF_SERIALIZER);
        RpcClientProxy nettyProxy = new RpcClientProxy(nettyClient);
        HelloService helloService = nettyProxy.getProxy(HelloService.class);
        ByeService byeService = nettyProxy.getProxy(ByeService.class);

        HelloObject object = new HelloObject(12, "This is a message");
        String res = helloService.hello(object);
        System.out.println(res);
        System.out.println(byeService.bye("Netty"));
    }
}
